package com.daydr3am.thenation;

import com.daydr3am.lib.CustomView;

import android.app.Activity;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class Vdo_View extends Activity implements OnCompletionListener {

	public VideoView my_vdo;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);	
		
		setContentView(R.layout.video_view);
		
		init();
		
		String vdo_url = CustomView.url_vdo;
		
		my_vdo.setVideoURI(Uri.parse(vdo_url));
		//my_vdo.setFocus();
		
		MediaController mc = new MediaController(this);
		my_vdo.setMediaController(mc);
		
		
	}
	
	private void init(){
		my_vdo = (VideoView) findViewById(R.id.my_vdo);
	}
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		my_vdo.start();
		my_vdo.setOnCompletionListener(this);
	}
	
	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		my_vdo.pause();
	}

	@Override
	public void onCompletion(MediaPlayer mp) {
		// TODO Auto-generated method stub
		finish();
	}
	
	
}
